package com.shenyue.nbtownlet.model;

import android.content.Context;

import com.alibaba.fastjson.JSONObject;
import com.shenyue.nbtownlet.event.BaseListener;

/**
 * 专题
 */

public class AppDissertationModel {

    /***获取专题类型接口****/
    private static final String XCZTHEMATICDATA_GETMENUARR = "XCZThematicData/GetMenuArr";
    public static final String XCZTHEMATICDATA_GETMENUARR_ACTION = "$xczthematicdata_getmenuarr_action$";

    /***新增专题信息接口****/
    private static final String XCZTHEMATICDATA_INSERTPOINT = "XCZThematicData/InsertPoint";
    public static final String XCZTHEMATICDATA_INSERTPOINT_ACTION = "$xczthematicdata_insertpoint_action$";


    /***获取专题数据列表****/
    private static final String XCZTHEMATICDATA_GETPOINTLIST = "XCZThematicData/GetPointList";
    public static final String XCZTHEMATICDATA_GETPOINTLIST_ACTION = "$xczthematicdata_getpointlist_action$";

    /***获取专题数据列表****/
    private static final String XCZTHEMATICDATA_GETPOINTBYID = "XCZThematicData/GetPointById";
    public static final String XCZTHEMATICDATA_GETPOINTBYID_ACTION = "$xczthematicdata_getpointbyid_action$";

    public static void GetMenuArr(final Context context, JSONObject param, final BaseListener listener) {
        NbzjClientExManager.instance().get(context, AppModel.kBaseURL + "/" + XCZTHEMATICDATA_GETMENUARR, XCZTHEMATICDATA_GETMENUARR_ACTION, param, new BaseListener() {
            @Override
            public void success(String val, String action) {
                if (listener != null)
                    listener.success(val, action);
            }

            @Override
            public void error(String error, String action) {
                if (listener != null)
                    listener.error(error, action);
            }
        });
    }

    public static void InsertPoint(final Context context, JSONObject param, final BaseListener listener) {
        NbzjClientExManager.instance().post(context, AppModel.kBaseURL + "/" + XCZTHEMATICDATA_INSERTPOINT, XCZTHEMATICDATA_INSERTPOINT_ACTION, param, new BaseListener() {
            @Override
            public void success(String val, String action) {
                if (listener != null)
                    listener.success(val, action);
            }

            @Override
            public void error(String error, String action) {
                if (listener != null)
                    listener.error(error, action);
            }
        });
    }

    public static void GetPointList(final Context context, JSONObject param, final BaseListener listener) {
        NbzjClientExManager.instance().get(context, AppModel.kBaseURL + "/" + XCZTHEMATICDATA_GETPOINTLIST, XCZTHEMATICDATA_GETPOINTLIST_ACTION, param, new BaseListener() {
            @Override
            public void success(String val, String action) {
                if (listener != null)
                    listener.success(val, action);
            }

            @Override
            public void error(String error, String action) {
                if (listener != null)
                    listener.error(error, action);
            }
        });
    }

    public static void GetPointById(final Context context, JSONObject param, final BaseListener listener) {
        NbzjClientExManager.instance().get(context, AppModel.kBaseURL + "/" + XCZTHEMATICDATA_GETPOINTBYID, XCZTHEMATICDATA_GETPOINTBYID_ACTION, param, new BaseListener() {
            @Override
            public void success(String val, String action) {
                if (listener != null)
                    listener.success(val, action);
            }

            @Override
            public void error(String error, String action) {
                if (listener != null)
                    listener.error(error, action);
            }
        });
    }
}
